import type { AxiosOperator } from '@/common/infrastructure/axios_operator.ts'

export class DemoApi {

    // 请求操作者
    private _requestOperator:AxiosOperator

    // 请求路由
    private controller:string = '/demoController'

    /**
     * 有参构造方法
     * @param requestOperator 请求操作者
     * */
    constructor(requestOperator:AxiosOperator) {
        this._requestOperator = requestOperator

    }

    /**
     * Get 样例
     * @param param1 参数1
     * @param param2 参数2
     * */
    // eslint-disable-next-line
    public async getDemo(param1:string, param2:string):Promise<any> {

        return await this._requestOperator.get(`${this.controller}/demoAction`, {
            demoParam1: param1,
            demoParam2: param2
        })
    }

    /**
     * Get 样例
     * @param param1 参数1
     * @param param2 参数2
     * */
    // eslint-disable-next-line
    public async postDemo(param1:string, param2:string):Promise<any> {

        return await this._requestOperator.post(`${this.controller}/demoAction`, {
            demoParam1: param1,
            demoParam2: param2
        })
    }
}
